<template>
  <div id="container">
    <el-menu
      class="el-menu-vertical-demo"
      text-color="#fff"
      background-color="#053794"
      :collapse-transition="false"
      router
      active-text-color="#ffd04b"
      :default-active="$route.path"
    >
      <el-menu-item v-if="user_id == 0 || user_id == 1" index="/admin/users">
        <i class="el-icon-menu"></i>
        <template #title>用户管理</template>
      </el-menu-item>
      <el-menu-item v-if="user_id == 0 || user_id == 1" index="/admin/boom">
        <i class="el-icon-document"></i>
        <template #title>轮播管理</template>
      </el-menu-item>
      <el-menu-item index="/admin/news">
        <i class="el-icon-setting"></i>
        <template #title>新闻管理</template>
      </el-menu-item>
      <el-menu-item v-if="user_id == 0 || user_id == 1" index="/admin/data">
        <i class="el-icon-eleme"></i>
        <template #title>数据可视化</template>
      </el-menu-item>
    </el-menu>
  </div>
</template>

<script lang="ts">
import { reactive } from "@vue/reactivity";

export default {
  name: "Menu",
  props: {
    user_id: {
      type: Number,
      default: -1,
    },
  },
  setup() {
    let state = reactive({
      menus: [],
    });
  },
};
</script>

<style scoped lang="less">
@import "../../../index.less";
.el-submenu .el-menu-item {
  min-width: auto;
}
#container {
  height: calc(100vh - @header-height);
  .el-menu-vertical-demo {
    width: @menu-width;
    .el-menu-item [class^="el-icon-"] {
      margin-right: 10px;
    }
    .sub_menu {
      padding-left: 53px !important;
    }
  }
}
.el-menu {
  border-right-width: 0;
}
.el-submenu__title > span {
  margin-left: 5px;
}

.is-active {
  background-color: rgba(209, 141, 129, 0.432) !important;
}
</style>

<style>
.el-menu--popup {
  min-width: 100px !important;
}
.el-menu-item-group__title {
  padding: 0 !important;
}
</style>